package org.z23.agentwork.service;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.stereotype.Service;

@Service
public class ChatService {
    private final ChatClient chatClient;

    public ChatService(ChatClient.Builder chatClientBuilder) {
        this.chatClient = chatClientBuilder.build();
    }

    public String chat(String userInput) {
        System.out.println("调用模型生成");
        String s = chatClient.prompt().user(userInput).call().content();
        System.out.println(s);
        return s;
    }
}
